<!DOCTYPE HTML>
<html>
<head>
    <title>查看交易</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/scripts/jquery.min.js"></script>
    <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
    <link rel="stylesheet" href="/editor/common.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/bootstrap/skin.css">
    <script src="/scripts/miniui/miniui.js"></script>
</head>
<body  style="padding: 0;width: 100%;height: 100%">
<div  style="width:100%;height:97%;">
    <div showCollapseButton="true" style="height: 98%">
        <div id="datagrid1" class="mini-datagrid" style="width:99%;height: 96%;"
             url="/getdata/queryAddressPageTx" idField="id" allowResize="true"
             sizeList="[20,30,50,100]" pageSize="20"
        >
            <div property="columns">
                <div field="amount" width="30" align="center" headerAlign="center" >交易总额</div>
                <div field="amountAssetId"  width="30" align="center" headerAlign="center" >交易币种</div>
                <div field="fee" width="30" align="center" headerAlign="center" >交易费用</div>
                <div field="trxId" width="100" align="center" headerAlign="center" >交易ID</div>
                <div field="fromAccount" width="100" align="center" headerAlign="center" >来源地址</div>
                <div field="toAccount" width="100" align="center" headerAlign="center" >去向地址</div>
                <div field="trxTimes" width="50" align="center" headerAlign="center" >交易时间</div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">

  var walletAddress = JSON.parse('<%- result %>');
  var flag = 1;
  mini.parse();
  var grid = mini.get("datagrid1");
  grid.load({walletAddress:walletAddress});
  grid.on("drawcell", function (e) {
    var  value = e.value;
  });

  function add() {
    mini.open({
      url: "/getdata/addWalletAddress",
      title: "增加地址", width: 400, height: 260,
      ondestroy: function (action) {
        grid.reload();
      }
    });
  };
  function remove() {
    var row = grid.getSelected();
    if (row) {
      $.ajax({
        url:"/getdata/walletAddressRemove",
        type:'POST',
        data:{
          objectId:row.objectId
        },
        success:function (result) {
          if (result){
            alert('钱包地址删除成功！')
          } else {
            alert('钱包地址删除失败！')
          }
          grid.reload();
        }
      });
    } else {
      alert("请选中一条记录");
    }
  };

  function distributeTEC() {
    var row = grid.getSelected();
    if (row) {
      mini.open({
        url: "/getdata/showDistributeTokenInfo?id=" + row.objectId,
        title: "发币", width: 400, height: 500,
        ondestroy: function (action) {
          grid.reload();
        }
      });
    } else {
      alert("请选中一条记录");
    }
  };

  function getDealList() {
    var row = grid.getSelected();
    if (row) {
      mini.open({
        url: "/getdata/queryAddressAllTx?walletAddress=" + row.walletAddress,
        title: "发币", width: 900, height: 600,
        ondestroy: function (action) {
          grid.reload();
        }
      });
    } else {
      alert("请选中一条记录");
    }
  };

</script>
</html>